#include "StdAfx.h"
#include "ZTIOfile.h"

void ZTIOFile::ReadDATA(CFile &openedMFILE,CString &str)
{
	int strLen;
	ReadDATA(openedMFILE,strLen);
	if(strLen > 0)
	{
		char *cextra = new char[strLen]; 
		openedMFILE.Read(cextra,strLen);
		CString ooooo(cextra);
		str = ooooo;
		delete cextra;
	}
}
void ZTIOFile::ReadDATA(CFile &openedMFILE,int& str)
{
	openedMFILE.Read(&str,sizeof(int));	
}
void ZTIOFile::WriteDATA(CFile &openedMFILE,int str)
{
	openedMFILE.Write(&str,sizeof(int));
}
void ZTIOFile::WriteDATA(CFile &openedMFILE,CString m_data)
{
 
	int strLen;
#ifdef UNICODE
	strLen = ( m_data.GetLength() + 1 )  * 2;
	char * newCharArray = new char[strLen];
	_wcstombsz( newCharArray, m_data, strLen );
#else
	strLen = m_data.GetLength()+1;
	char * dddd = (LPTSTR)(LPCTSTR)m_data;
	char * newCharArray = new char[strLen];
	strcpy (newCharArray,dddd);
#endif
	WriteDATA(openedMFILE,strLen);
	openedMFILE.Write(newCharArray,strLen);
	delete newCharArray;
}

 